import { round } from 'lodash'

export default {
  type: 'line',
  lineStyle: {
    type: 'dashed',
    color: '#ff00ce',
    width: 3
  },
  markPoint: {
    symbolSize: 1,
    symbolOffset: [0, '50%'],
    label: {
      formatter: function(params) {
        const {
          data: { kData, value, k }
        } = params
        const [, , close] = kData
        let _num = 0
        let _zsql = 0
        if (value != null && close != null && k != null) {
          _zsql = value - close
          _num = round(_zsql / k)
        }
        return `{a|追索气量: ${_zsql.toFixed(2)} 方}\n{a|折合零气量: ${_num} 天}`
      },
      position: 'top',
      distance: 5,
      backgroundColor: 'rgba(255, 0, 206, .6)',
      borderColor: '#ff00ce',
      borderRadius: 2,
      padding: [5, 5],
      rich: {
        a: {
          align: 'left',
          color: '#fff',
          fontSize: 16,
          lineHeight: 22,
          textShadowBlur: 2,
          textShadowColor: '#000',
          textShadowOffsetX: 0,
          textShadowOffsetY: 1,
          textBorderColor: '#333',
          textBorderWidth: 2
        }
      }
    }
  }
}
